<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>合生元</title>
    <script>var phoneWidth = parseInt(window.screen.width);
var phoneHeight = parseInt(window.screen.height);
var phoneScale = phoneWidth / 640;
var ua = navigator.userAgent;
if (/Android (\d+\.\d+)/.test(ua)) {
    var version = parseFloat(RegExp.$1);
    if (version > 2.3) {
        document.write('<meta name="viewport" content="width=640, initial-scale= ' + phoneScale + ' ,minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
    }
    else {
        document.write('<meta name="viewport" content="width=640, initial-scale= ' + phoneScale + ' , target-densitydpi=device-dpi">');
    }
}
else {
    document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
}</script>
    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="../assets/css/draw/main2.css?v=${fns:getConfig('drawVersion')}"/>
</head>
<body>
<div class="wrap page-group consignee">
    <div class="page page-current">
        <h2 class="consignee-title consignee-title1">恭喜您抢了</h2>
        <h2 class="consignee-title consignee-title2"><span>${awardname }</span></h2>
        <form action="${ctxFront}/updateWinner" method="post" id="form">
            <input type="hidden" id="winnerid"  name="winnerid" value="${winnerid }"/>
           	<input type="hidden" id="openid"  name="openid" value="${openid }"/>
           	<input type="hidden" id="sign"  name="sign" value="${sign }"/>
           	<input type="hidden" id="fromSystem"  name="fromSystem" value="${fromSystem}"/>       
            <div class="form-box">
                <input type="text"  name="receiver" placeholder="姓名" id="username">
                <input type="text" name="recMobile"  placeholder="手机号" id="phone" maxlength="11">
                <input type="text" id='city-picker' name="recAddr1"  placeholder="请选择地区"/>
                <i class="arrow-right"><img src="../assets/images/draw2/arrow-right-o.png" alt="合生元" height="22" width="22"></i>
                <input type="text" name="recAddr2"  placeholder="详细地址" id="address">
                <a href="javascript:;" class="sub-btn">确 定</a>
            </div>
        </form>
        <footer></footer>
    </div>
</div>


<!--js-->
<script src="http://wximg.qq.com/wxp/libs/wxmoment/0.0.4/wxmoment.min.js"></script>
<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
<script type="text/javascript" src="http://g.alicdn.com/msui/sm/0.6.2/js/sm-city-picker.min.js"
        charset="utf-8"></script>
<script>
    $("#city-picker,.arrow-right").cityPicker({
        toolbarTemplate: '<header class="bar bar-nav">\
    <button class="button button-link pull-right close-picker">确定</button>\
    <h1 class="title">请选择省市区</h1>\
    </header>'
    });

    //表单提交验证
    function sub() {
        var username = $('#username');//用户姓名
        var phone = $('#phone');//手机号码
        var address = $('#address');//地址
        var cityPicke = $('#city-picker');
        var re = /^1\d{10}$/;//验证手机格式正则表达式
        if (username.val().trim() == "" || username.val().trim() == null) {
            alert("姓名不能为空！");
            username.focus();
            return false;
        } else if (phone.val().trim() == "" || phone.val().trim() == null) {
            alert("手机号码不能为空！");
            phone.focus();
            return false
        } else if (address.val().trim() == "" || address.val().trim() == null) {
            alert("详细地址不能为空！");
            address.focus();
            return false;
        } else if (cityPicke.val().trim() == "" || cityPicke.val().trim() == null) {
            alert("请选择地区！");
            cityPicke.focus();
            return false;
        }
        if (re.test(phone.val().trim())) {
            $('#form').submit();
            return true;
        } else {
            alert("手机号码格式不对！");
            phone.focus();
            return false;
        }
    }
    //点击提交表单
    $('.sub-btn').on('tap', function () {
        sub();
    });
</script>
</body>
</html>